Importing required libraries¶
| Sno | Date | Time | State/UnionTerritory | ConfirmedIndianNational | ConfirmedForeignNational | Cured | Deaths | Confirmed | |
|---|---|---|---|---|---|---|---|---|---|
| 0 | 1 | 2020-01-30 | 6:00 PM | Kerala | 1 | 0 | 0 | 0 | 1 |
| 1 | 2 | 2020-01-31 | 6:00 PM | Kerala | 1 | 0 | 0 | 0 | 1 |
| 2 | 3 | 2020-02-01 | 6:00 PM | Kerala | 2 | 0 | 0 | 0 | 2 |
| 3 | 4 | 2020-02-02 | 6:00 PM | Kerala | 3 | 0 | 0 | 0 | 3 |
| 4 | 5 | 2020-02-03 | 6:00 PM | Kerala | 3 | 0 | 0 | 0 | 3 |
Converting date column to datetime datatype
Renaming columns
Index(['Sno', 'Date', 'Time', 'States', 'ConfirmedIndianNational',
'ConfirmedForeignNational', 'Cured', 'Deaths', 'Confirmed'],
dtype='object')
Checking null values
Sno 0 Date 0 Time 0 States 0 ConfirmedIndianNational 0 ConfirmedForeignNational 0 Cured 0 Deaths 0 Confirmed 0 dtype: int64
(18110, 9)
Dropping unwanted columns
| Date | Time | States | Cured | Deaths | Confirmed | |
|---|---|---|---|---|---|---|
| 0 | 2020-01-30 | 6:00 PM | Kerala | 0 | 0 | 1 |
| 1 | 2020-01-31 | 6:00 PM | Kerala | 0 | 0 | 1 |
| 2 | 2020-02-01 | 6:00 PM | Kerala | 0 | 0 | 2 |
| 3 | 2020-02-02 | 6:00 PM | Kerala | 0 | 0 | 3 |
| 4 | 2020-02-03 | 6:00 PM | Kerala | 0 | 0 | 3 |
Calculating active value
| Date | Time | States | Cured | Deaths | Confirmed | Active | |
|---|---|---|---|---|---|---|---|
| 18105 | 2021-08-11 | 8:00 AM | Telangana | 638410 | 3831 | 650353 | 8112 |
| 18106 | 2021-08-11 | 8:00 AM | Tripura | 77811 | 773 | 80660 | 2076 |
| 18107 | 2021-08-11 | 8:00 AM | Uttarakhand | 334650 | 7368 | 342462 | 444 |
| 18108 | 2021-08-11 | 8:00 AM | Uttar Pradesh | 1685492 | 22775 | 1708812 | 545 |
| 18109 | 2021-08-11 | 8:00 AM | West Bengal | 1506532 | 18252 | 1534999 | 10215 |
| Date | Time | States | Cured | Deaths | Confirmed | Active | |
|---|---|---|---|---|---|---|---|
| 0 | 2020-01-30 | 6:00 PM | Kerala | 0 | 0 | 1 | 1 |
| 1 | 2020-01-31 | 6:00 PM | Kerala | 0 | 0 | 1 | 1 |
| 2 | 2020-02-01 | 6:00 PM | Kerala | 0 | 0 | 2 | 2 |
| 3 | 2020-02-02 | 6:00 PM | Kerala | 0 | 0 | 3 | 3 |
| 4 | 2020-02-03 | 6:00 PM | Kerala | 0 | 0 | 3 | 3 |
Dataset Information
<class 'pandas.core.frame.DataFrame'> RangeIndex: 18110 entries, 0 to 18109 Data columns (total 7 columns): # Column Non-Null Count Dtype --- ------ -------------- ----- 0 Date 18110 non-null datetime64[ns] 1 Time 18110 non-null object 2 States 18110 non-null object 3 Cured 18110 non-null int64 4 Deaths 18110 non-null int64 5 Confirmed 18110 non-null int64 6 Active 18110 non-null int64 dtypes: datetime64[ns](1), int64(4), object(2) memory usage: 990.5+ KB
After manipulating covid_summary data there are 2 categorical, 1 datetime, 1 float and 4 int values
Selecting maximum date data
Timestamp('2021-08-11 00:00:00')
| Cured | Deaths | Confirmed | Active | |
|---|---|---|---|---|
| States | ||||
| Andaman and Nicobar Islands | 7412 | 129 | 7548 | 7 |
| Andhra Pradesh | 1952736 | 13564 | 1985182 | 18882 |
| Arunachal Pradesh | 47821 | 248 | 50605 | 2536 |
| Assam | 559684 | 5420 | 576149 | 11045 |
| Bihar | 715352 | 9646 | 725279 | 281 |
Looking at 2021 total cured, deaths, confirmed and active data
| Cured | Deaths | Confirmed | Active | |
|---|---|---|---|---|
| 0 | 31220981 | 429179 | 32036511 | 386351 |
Storing confirmed, death and cured data<.b>
| Date | Confirmed | Deaths | Cured | |
|---|---|---|---|---|
| 0 | 2020-01-30 | 1 | 0 | 0 |
| 1 | 2020-01-31 | 1 | 0 | 0 |
| 2 | 2020-02-01 | 2 | 0 | 0 |
| 3 | 2020-02-02 | 3 | 0 | 0 |
| 4 | 2020-02-03 | 3 | 0 | 0 |
Cured, Deaths, Confirmed Trend bar
Method to plot bar chart
Top 10 Death States
Top 10 Confirmed States
Top 10 Cured States
Since we know that maharashtra is most affected state of India lets look at other data of Maharashtra. To proceed forward lets read vaccination data
Observing Vaccination data on Maharashtra State
| Updated On | State | Total Doses Administered | Sessions | Sites | First Dose Administered | Second Dose Administered | Male (Doses Administered) | Female (Doses Administered) | Transgender (Doses Administered) | ... | 18-44 Years (Doses Administered) | 45-60 Years (Doses Administered) | 60+ Years (Doses Administered) | 18-44 Years(Individuals Vaccinated) | 45-60 Years(Individuals Vaccinated) | 60+ Years(Individuals Vaccinated) | Male(Individuals Vaccinated) | Female(Individuals Vaccinated) | Transgender(Individuals Vaccinated) | Total Individuals Vaccinated | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 7840 | 11/08/2021 | West Bengal | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
| 7841 | 12/08/2021 | West Bengal | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
| 7842 | 13/08/2021 | West Bengal | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
| 7843 | 14/08/2021 | West Bengal | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
| 7844 | 15/08/2021 | West Bengal | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
5 rows × 24 columns
Index(['Date', 'State', 'Total Doses Administered', 'Sessions', ' Sites ',
'First Dose Administered', 'Second Dose Administered',
'Male (Doses Administered)', 'Female (Doses Administered)',
'Transgender (Doses Administered)', ' Covaxin (Doses Administered)',
'CoviShield (Doses Administered)', 'Sputnik V (Doses Administered)',
'AEFI', '18-44 Years (Doses Administered)',
'45-60 Years (Doses Administered)', '60+ Years (Doses Administered)',
'18-44 Years(Individuals Vaccinated)',
'45-60 Years(Individuals Vaccinated)',
'60+ Years(Individuals Vaccinated)', 'Male(Individuals Vaccinated)',
'Female(Individuals Vaccinated)', 'Transgender(Individuals Vaccinated)',
'Total Individuals Vaccinated', 'Total Vaccinatons'],
dtype='object')
Date 0 State 0 Total Doses Administered 6 Sessions 6 Sites 6 First Dose Administered 6 Second Dose Administered 6 Male (Doses Administered) 6 Female (Doses Administered) 6 Transgender (Doses Administered) 6 Covaxin (Doses Administered) 6 CoviShield (Doses Administered) 6 Sputnik V (Doses Administered) 131 AEFI 65 18-44 Years (Doses Administered) 166 45-60 Years (Doses Administered) 166 60+ Years (Doses Administered) 166 18-44 Years(Individuals Vaccinated) 112 45-60 Years(Individuals Vaccinated) 111 60+ Years(Individuals Vaccinated) 111 Male(Individuals Vaccinated) 212 Female(Individuals Vaccinated) 212 Transgender(Individuals Vaccinated) 212 Total Individuals Vaccinated 52 Total Vaccinatons 6 dtype: int64
Date 0 State 0 Total Doses Administered 0 Sessions 0 Sites 0 First Dose Administered 0 Second Dose Administered 0 Male (Doses Administered) 0 Female (Doses Administered) 0 Transgender (Doses Administered) 0 Covaxin (Doses Administered) 0 CoviShield (Doses Administered) 0 Sputnik V (Doses Administered) 0 AEFI 0 18-44 Years (Doses Administered) 0 45-60 Years (Doses Administered) 0 60+ Years (Doses Administered) 0 18-44 Years(Individuals Vaccinated) 0 45-60 Years(Individuals Vaccinated) 0 60+ Years(Individuals Vaccinated) 0 Male(Individuals Vaccinated) 0 Female(Individuals Vaccinated) 0 Transgender(Individuals Vaccinated) 0 Total Individuals Vaccinated 0 Total Vaccinatons 0 dtype: int64
Total vaccination provided on Maharashtra
Total CoviShield vaccination provided on Maharashtra
Total Covaxin vaccination provided on Maharashtra
We used the Prophet library, which was created by Facebook and is used for Time Series Forecasting, to make our predictions. Prophet is a time series data forecasting procedure based on an additive model that fits non-linear trends with yearly, weekly, and daily seasonality, as well as holiday effects. It works best with time series with strong seasonal effects and historical data from multiple seasons.
FBProphet¶
Making model to predict and compare the confirmed data¶
| Date | Confirmed | |
|---|---|---|
| 555 | 2021-08-07 | 31895385 |
| 556 | 2021-08-08 | 31934455 |
| 557 | 2021-08-09 | 31969954 |
| 558 | 2021-08-10 | 31998158 |
| 559 | 2021-08-11 | 32036511 |
<fbprophet.forecaster.Prophet at 0x1b939e37eb0>
Future 30 days date prediction
| ds | |
|---|---|
| 585 | 2021-09-06 |
| 586 | 2021-09-07 |
| 587 | 2021-09-08 |
| 588 | 2021-09-09 |
| 589 | 2021-09-10 |
Forcasting India confirmation data
| ds | trend | yhat_lower | yhat_upper | trend_lower | trend_upper | additive_terms | additive_terms_lower | additive_terms_upper | weekly | weekly_lower | weekly_upper | multiplicative_terms | multiplicative_terms_lower | multiplicative_terms_upper | yhat | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 2020-01-30 | -1.945281e+05 | -1.836273e+06 | 1.420716e+06 | -1.945281e+05 | -1.945281e+05 | 20670.809283 | 20670.809283 | 20670.809283 | 20670.809283 | 20670.809283 | 20670.809283 | 0.0 | 0.0 | 0.0 | -1.738573e+05 |
| 1 | 2020-01-31 | -1.912244e+05 | -1.769051e+06 | 1.338023e+06 | -1.912244e+05 | -1.912244e+05 | 15736.475838 | 15736.475838 | 15736.475838 | 15736.475838 | 15736.475838 | 15736.475838 | 0.0 | 0.0 | 0.0 | -1.754879e+05 |
| 2 | 2020-02-01 | -1.879207e+05 | -1.765816e+06 | 1.367934e+06 | -1.879207e+05 | -1.879207e+05 | 10539.935153 | 10539.935153 | 10539.935153 | 10539.935153 | 10539.935153 | 10539.935153 | 0.0 | 0.0 | 0.0 | -1.773807e+05 |
| 3 | 2020-02-02 | -1.846169e+05 | -1.748840e+06 | 1.402066e+06 | -1.846169e+05 | -1.846169e+05 | 4514.591868 | 4514.591868 | 4514.591868 | 4514.591868 | 4514.591868 | 4514.591868 | 0.0 | 0.0 | 0.0 | -1.801023e+05 |
| 4 | 2020-02-03 | -1.813132e+05 | -1.682445e+06 | 1.387868e+06 | -1.813132e+05 | -1.813132e+05 | -4087.407399 | -4087.407399 | -4087.407399 | -4087.407399 | -4087.407399 | -4087.407399 | 0.0 | 0.0 | 0.0 | -1.854006e+05 |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| 585 | 2021-09-06 | 4.053997e+07 | 3.880602e+07 | 4.206546e+07 | 4.032867e+07 | 4.077778e+07 | -4087.407399 | -4087.407399 | -4087.407399 | -4087.407399 | -4087.407399 | -4087.407399 | 0.0 | 0.0 | 0.0 | 4.053588e+07 |
| 586 | 2021-09-07 | 4.070569e+07 | 3.912970e+07 | 4.244741e+07 | 4.047697e+07 | 4.095049e+07 | -18976.383761 | -18976.383761 | -18976.383761 | -18976.383761 | -18976.383761 | -18976.383761 | 0.0 | 0.0 | 0.0 | 4.068672e+07 |
| 587 | 2021-09-08 | 4.087142e+07 | 3.914108e+07 | 4.246668e+07 | 4.062752e+07 | 4.112666e+07 | -28398.020981 | -28398.020981 | -28398.020981 | -28398.020981 | -28398.020981 | -28398.020981 | 0.0 | 0.0 | 0.0 | 4.084302e+07 |
| 588 | 2021-09-09 | 4.103715e+07 | 3.928715e+07 | 4.261594e+07 | 4.078187e+07 | 4.130496e+07 | 20670.809283 | 20670.809283 | 20670.809283 | 20670.809283 | 20670.809283 | 20670.809283 | 0.0 | 0.0 | 0.0 | 4.105782e+07 |
| 589 | 2021-09-10 | 4.120287e+07 | 3.964374e+07 | 4.299325e+07 | 4.092711e+07 | 4.148270e+07 | 15736.475837 | 15736.475837 | 15736.475837 | 15736.475837 | 15736.475837 | 15736.475837 | 0.0 | 0.0 | 0.0 | 4.121861e+07 |
590 rows × 16 columns
The below image shows the basic prediction. The light blue is the uncertainty level(yhat_upper and yhat_lower), the dark blue is the prediction(yhat) and the black line is the original data.
Basic line plot Forecast India Confirmation
The images below depict the time series data's trends and seasonality (within a year).
Forecasting India confirmation weekly and trend data
In rapid trend growths, changepoints are added to indicate the time. The dotted red lines indicate when there was a significant change in the passenger trend.
Forecasting India confirmed data with changepoints
Predicting the number of cases till Oct 2021, there will be more than 45 millions people who will be affected by coronavirus
Making model to predict and compare the cured data¶
| Date | Cured | |
|---|---|---|
| 555 | 2021-08-07 | 31055861 |
| 556 | 2021-08-08 | 31099771 |
| 557 | 2021-08-09 | 31139457 |
| 558 | 2021-08-10 | 31180968 |
| 559 | 2021-08-11 | 31220981 |
| ds | y | |
|---|---|---|
| 555 | 2021-08-07 | 31055861 |
| 556 | 2021-08-08 | 31099771 |
| 557 | 2021-08-09 | 31139457 |
| 558 | 2021-08-10 | 31180968 |
| 559 | 2021-08-11 | 31220981 |
| ds | |
|---|---|
| 585 | 2021-09-06 |
| 586 | 2021-09-07 |
| 587 | 2021-09-08 |
| 588 | 2021-09-09 |
| 589 | 2021-09-10 |
| ds | trend | yhat_lower | yhat_upper | trend_lower | trend_upper | additive_terms | additive_terms_lower | additive_terms_upper | weekly | weekly_lower | weekly_upper | multiplicative_terms | multiplicative_terms_lower | multiplicative_terms_upper | yhat | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 2020-01-30 | -1.158339e+05 | -1.468481e+06 | 1.305507e+06 | -1.158339e+05 | -1.158339e+05 | 20451.412190 | 20451.412190 | 20451.412190 | 20451.412190 | 20451.412190 | 20451.412190 | 0.0 | 0.0 | 0.0 | -9.538248e+04 |
| 1 | 2020-01-31 | -1.139421e+05 | -1.452425e+06 | 1.271701e+06 | -1.139421e+05 | -1.139421e+05 | 13607.673366 | 13607.673366 | 13607.673366 | 13607.673366 | 13607.673366 | 13607.673366 | 0.0 | 0.0 | 0.0 | -1.003344e+05 |
| 2 | 2020-02-01 | -1.120502e+05 | -1.471254e+06 | 1.166625e+06 | -1.120502e+05 | -1.120502e+05 | 7765.453372 | 7765.453372 | 7765.453372 | 7765.453372 | 7765.453372 | 7765.453372 | 0.0 | 0.0 | 0.0 | -1.042848e+05 |
| 3 | 2020-02-02 | -1.101584e+05 | -1.501450e+06 | 1.329662e+06 | -1.101584e+05 | -1.101584e+05 | 2085.288507 | 2085.288507 | 2085.288507 | 2085.288507 | 2085.288507 | 2085.288507 | 0.0 | 0.0 | 0.0 | -1.080731e+05 |
| 4 | 2020-02-03 | -1.082666e+05 | -1.595541e+06 | 1.254691e+06 | -1.082666e+05 | -1.082666e+05 | -8067.857442 | -8067.857442 | -8067.857442 | -8067.857442 | -8067.857442 | -8067.857442 | 0.0 | 0.0 | 0.0 | -1.163345e+05 |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| 585 | 2021-09-06 | 3.953173e+07 | 3.816574e+07 | 4.088229e+07 | 3.927164e+07 | 3.974831e+07 | -8067.857442 | -8067.857442 | -8067.857442 | -8067.857442 | -8067.857442 | -8067.857442 | 0.0 | 0.0 | 0.0 | 3.952366e+07 |
| 586 | 2021-09-07 | 3.970386e+07 | 3.818226e+07 | 4.098763e+07 | 3.943088e+07 | 3.993058e+07 | -13767.146379 | -13767.146379 | -13767.146379 | -13767.146379 | -13767.146379 | -13767.146379 | 0.0 | 0.0 | 0.0 | 3.969010e+07 |
| 587 | 2021-09-08 | 3.987600e+07 | 3.850566e+07 | 4.125089e+07 | 3.957728e+07 | 4.011847e+07 | -22074.823614 | -22074.823614 | -22074.823614 | -22074.823614 | -22074.823614 | -22074.823614 | 0.0 | 0.0 | 0.0 | 3.985393e+07 |
| 588 | 2021-09-09 | 4.004814e+07 | 3.863782e+07 | 4.140736e+07 | 3.973356e+07 | 4.030339e+07 | 20451.412190 | 20451.412190 | 20451.412190 | 20451.412190 | 20451.412190 | 20451.412190 | 0.0 | 0.0 | 0.0 | 4.006859e+07 |
| 589 | 2021-09-10 | 4.022027e+07 | 3.892233e+07 | 4.163199e+07 | 3.989079e+07 | 4.049674e+07 | 13607.673365 | 13607.673365 | 13607.673365 | 13607.673365 | 13607.673365 | 13607.673365 | 0.0 | 0.0 | 0.0 | 4.023388e+07 |
590 rows × 16 columns
The below image shows the basic prediction. The light blue is the uncertainty level(yhat_upper and yhat_lower), the dark blue is the prediction(yhat) and the black line is the original data.
Basic line plot Forecast India Cured
The images below depict the time series data's trends and seasonality (within a year).
Forecasting India Cured weekly and trend data
In rapid trend growths, changepoints are added to indicate the time. The dotted red lines indicate when there was a significant change in the passenger trend.
Forecasting India cured data with changepoints
Predicting number of cured till Oct 2021 will be more than 40 million
Making model to predict and compare the cured data¶
| Date | Deaths | |
|---|---|---|
| 555 | 2021-08-07 | 427371 |
| 556 | 2021-08-08 | 427862 |
| 557 | 2021-08-09 | 428309 |
| 558 | 2021-08-10 | 428682 |
| 559 | 2021-08-11 | 429179 |
| ds | |
|---|---|
| 585 | 2021-09-06 |
| 586 | 2021-09-07 |
| 587 | 2021-09-08 |
| 588 | 2021-09-09 |
| 589 | 2021-09-10 |
| ds | trend | yhat_lower | yhat_upper | trend_lower | trend_upper | additive_terms | additive_terms_lower | additive_terms_upper | weekly | weekly_lower | weekly_upper | multiplicative_terms | multiplicative_terms_lower | multiplicative_terms_upper | yhat | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 2020-01-30 | -2199.302798 | -15937.214557 | 12346.712912 | -2199.302798 | -2199.302798 | 274.316839 | 274.316839 | 274.316839 | 274.316839 | 274.316839 | 274.316839 | 0.0 | 0.0 | 0.0 | -1924.985959 |
| 1 | 2020-01-31 | -2149.567673 | -16837.756422 | 11142.038380 | -2149.567673 | -2149.567673 | 194.220341 | 194.220341 | 194.220341 | 194.220341 | 194.220341 | 194.220341 | 0.0 | 0.0 | 0.0 | -1955.347332 |
| 2 | 2020-02-01 | -2099.832549 | -17360.268628 | 12467.742619 | -2099.832549 | -2099.832549 | 144.504564 | 144.504564 | 144.504564 | 144.504564 | 144.504564 | 144.504564 | 0.0 | 0.0 | 0.0 | -1955.327985 |
| 3 | 2020-02-02 | -2050.097425 | -16740.243007 | 11859.622955 | -2050.097425 | -2050.097425 | 37.969937 | 37.969937 | 37.969937 | 37.969937 | 37.969937 | 37.969937 | 0.0 | 0.0 | 0.0 | -2012.127488 |
| 4 | 2020-02-03 | -2000.362300 | -15966.728200 | 12515.753614 | -2000.362300 | -2000.362300 | -93.461547 | -93.461547 | -93.461547 | -93.461547 | -93.461547 | -93.461547 | 0.0 | 0.0 | 0.0 | -2093.823847 |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| 585 | 2021-09-06 | 537128.772850 | 522271.298147 | 552985.488646 | 534022.192114 | 540276.061650 | -93.461547 | -93.461547 | -93.461547 | -93.461547 | -93.461547 | -93.461547 | 0.0 | 0.0 | 0.0 | 537035.311303 |
| 586 | 2021-09-07 | 539499.684080 | 523855.939795 | 555215.448787 | 536149.029965 | 542938.547049 | -260.003341 | -260.003341 | -260.003341 | -260.003341 | -260.003341 | -260.003341 | 0.0 | 0.0 | 0.0 | 539239.680738 |
| 587 | 2021-09-08 | 541870.595309 | 526704.353432 | 556166.780907 | 538315.742208 | 545528.792062 | -297.546792 | -297.546792 | -297.546792 | -297.546792 | -297.546792 | -297.546792 | 0.0 | 0.0 | 0.0 | 541573.048517 |
| 588 | 2021-09-09 | 544241.506538 | 528487.239743 | 559420.830376 | 540492.722305 | 548073.173042 | 274.316839 | 274.316839 | 274.316839 | 274.316839 | 274.316839 | 274.316839 | 0.0 | 0.0 | 0.0 | 544515.823377 |
| 589 | 2021-09-10 | 546612.417768 | 531514.250211 | 562217.849584 | 542630.376465 | 550703.356801 | 194.220341 | 194.220341 | 194.220341 | 194.220341 | 194.220341 | 194.220341 | 0.0 | 0.0 | 0.0 | 546806.638109 |
590 rows × 16 columns
The below image shows the basic prediction. The light blue is the uncertainty level(yhat_upper and yhat_lower), the dark blue is the prediction(yhat) and the black line is the original data.
Basic line plot Forecast India Deaths
The images below depict the time series data's trends and seasonality (within a year).
Forecasting India Deaths weekly and trend data
In rapid trend growths, changepoints are added to indicate the time. The dotted red lines indicate when there was a significant change in the passenger trend.
Forecasting India deaths data with changepoints
Predicting number of deaths till Oct 2021 will be more than 600k. We can see that current situation of the India is not under control.
Accuracy testing by taking kerela states¶
Copying origingal dataset
| ds | Time | States | y | Deaths | Confirmed | Active | |
|---|---|---|---|---|---|---|---|
| 0 | 2020-01-30 | 6:00 PM | Kerala | 0 | 0 | 1 | 1 |
| 1 | 2020-01-31 | 6:00 PM | Kerala | 0 | 0 | 1 | 1 |
| 2 | 2020-02-01 | 6:00 PM | Kerala | 0 | 0 | 2 | 2 |
| 3 | 2020-02-02 | 6:00 PM | Kerala | 0 | 0 | 3 | 3 |
| 4 | 2020-02-03 | 6:00 PM | Kerala | 0 | 0 | 3 | 3 |
Removing unwanted state data
array(['Kerala', 'Telengana', 'Delhi', 'Rajasthan', 'Uttar Pradesh',
'Haryana', 'Ladakh', 'Tamil Nadu', 'Karnataka', 'Maharashtra',
'Punjab', 'Jammu and Kashmir', 'Andhra Pradesh', 'Uttarakhand',
'Odisha', 'Puducherry', 'West Bengal', 'Chhattisgarh',
'Chandigarh', 'Gujarat', 'Himachal Pradesh', 'Madhya Pradesh',
'Bihar', 'Manipur', 'Mizoram', 'Andaman and Nicobar Islands',
'Goa', 'Unassigned', 'Assam', 'Jharkhand', 'Arunachal Pradesh',
'Tripura', 'Nagaland', 'Meghalaya',
'Dadra and Nagar Haveli and Daman and Diu',
'Cases being reassigned to states', 'Sikkim', 'Daman & Diu',
'Lakshadweep', 'Telangana', 'Dadra and Nagar Haveli',
'Himanchal Pradesh', 'Karanataka'], dtype=object)
Observing maximum and minimum data
Timestamp('2021-08-11 00:00:00')
Timestamp('2020-01-30 00:00:00')
Seperating training and testing data
(12566, 7)
(5540, 7)
| ds | Time | States | y | Deaths | Confirmed | Active | |
|---|---|---|---|---|---|---|---|
| 0 | 2020-01-30 | 6:00 PM | Kerala | 0 | 0 | 1 | 1 |
| 1 | 2020-01-31 | 6:00 PM | Kerala | 0 | 0 | 1 | 1 |
| 2 | 2020-02-01 | 6:00 PM | Kerala | 0 | 0 | 2 | 2 |
| 3 | 2020-02-02 | 6:00 PM | Kerala | 0 | 0 | 3 | 3 |
| 4 | 2020-02-03 | 6:00 PM | Kerala | 0 | 0 | 3 | 3 |
Forecasting Kerala data with prophet prediction
| ds | trend | yhat_lower | yhat_upper | trend_lower | trend_upper | additive_terms | additive_terms_lower | additive_terms_upper | weekly | weekly_lower | weekly_upper | multiplicative_terms | multiplicative_terms_lower | multiplicative_terms_upper | yhat | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 2020-01-30 | -9.703408e+01 | -3.234766e+03 | 3.590867e+03 | -9.703408e+01 | -9.703408e+01 | 112.166231 | 112.166231 | 112.166231 | 112.166231 | 112.166231 | 112.166231 | 0.0 | 0.0 | 0.0 | 1.513216e+01 |
| 1 | 2020-01-31 | -9.393595e+01 | -3.244146e+03 | 3.412608e+03 | -9.393595e+01 | -9.393595e+01 | 94.673872 | 94.673872 | 94.673872 | 94.673872 | 94.673872 | 94.673872 | 0.0 | 0.0 | 0.0 | 7.379257e-01 |
| 2 | 2020-02-01 | -9.083782e+01 | -3.570888e+03 | 3.385396e+03 | -9.083782e+01 | -9.083782e+01 | 37.147985 | 37.147985 | 37.147985 | 37.147985 | 37.147985 | 37.147985 | 0.0 | 0.0 | 0.0 | -5.368983e+01 |
| 3 | 2020-02-02 | -8.773969e+01 | -3.445288e+03 | 3.357780e+03 | -8.773969e+01 | -8.773969e+01 | 56.673879 | 56.673879 | 56.673879 | 56.673879 | 56.673879 | 56.673879 | 0.0 | 0.0 | 0.0 | -3.106581e+01 |
| 4 | 2020-02-03 | -8.464156e+01 | -3.308185e+03 | 3.446105e+03 | -8.464156e+01 | -8.464156e+01 | 13.688051 | 13.688051 | 13.688051 | 13.688051 | 13.688051 | 13.688051 | 0.0 | 0.0 | 0.0 | -7.095351e+01 |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| 431 | 2021-04-05 | 1.185537e+06 | 1.173031e+06 | 1.198146e+06 | 1.174239e+06 | 1.198111e+06 | 13.688051 | 13.688051 | 13.688051 | 13.688051 | 13.688051 | 13.688051 | 0.0 | 0.0 | 0.0 | 1.185550e+06 |
| 432 | 2021-04-06 | 1.190764e+06 | 1.177212e+06 | 1.204733e+06 | 1.178478e+06 | 1.203946e+06 | -150.791339 | -150.791339 | -150.791339 | -150.791339 | -150.791339 | -150.791339 | 0.0 | 0.0 | 0.0 | 1.190614e+06 |
| 433 | 2021-04-07 | 1.195992e+06 | 1.181800e+06 | 1.210919e+06 | 1.182797e+06 | 1.209764e+06 | -163.558678 | -163.558678 | -163.558678 | -163.558678 | -163.558678 | -163.558678 | 0.0 | 0.0 | 0.0 | 1.195829e+06 |
| 434 | 2021-04-08 | 1.201220e+06 | 1.186905e+06 | 1.217140e+06 | 1.187258e+06 | 1.215659e+06 | 112.166231 | 112.166231 | 112.166231 | 112.166231 | 112.166231 | 112.166231 | 0.0 | 0.0 | 0.0 | 1.201332e+06 |
| 435 | 2021-04-09 | 1.206447e+06 | 1.190917e+06 | 1.222322e+06 | 1.191428e+06 | 1.221715e+06 | 94.673872 | 94.673872 | 94.673872 | 94.673872 | 94.673872 | 94.673872 | 0.0 | 0.0 | 0.0 | 1.206542e+06 |
436 rows × 16 columns
Basic forcasted line plot of Kerala
Accuracy testing
(436, 2)
(154, 2)
32402424 1517167.9528269023
0.9531773316457157
Here we got 95 percentage of accuracy on forcasted data which is good
Checking forecasting accuracy for top 5 populated states¶
['Uttar Pradesh', 'Maharashtra', 'Bihar', 'West Bengal', 'Madhya Pradesh']
Uttar Pradesh: 0.9810909368947742
Maharashtra: 0.9159660536396657
Bihar: 0.9770128540772085
West Bengal: 0.9860752640040191
Madhya Pradesh: 0.9830944209538308